/*<summary>
Created By : Preeti
Created On : 9/20/2008
Class Name : PatientProcudureDetail_Mapper
Used In    : 
------------------------------------------------------------------------
Modification Log  
------------------------------------------------------------------------
Created By        Modified By         Remarks                             
-----------       ------------        ----------------------------------
                                                                          
------------------------------------------------------------------------
</summary>*/


using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Utils;

namespace InPatientCntroller
{
    public class PatientProcudureDetail_Mapper
    {
        public bool Load_PatientProcudureDetail_DATA(string ID, PatientProcudureDetail objPatientProcudureDetail)
        {
            if (!(objPatientProcudureDetail == null))
            {
                ezUtilsAdapter DBL = new ezUtilsAdapter();
                int ResultVal;
                bool bresult;
                string CRNumber;
                string ProcedureName;
                string ProcedureCode;
                string ProcedureDate;
                string ProcedureTime;
                string Remarks;
                string Consultant;
                string ReportId;
                string Billing;

                CRNumber = objPatientProcudureDetail.CRNumber;
                ProcedureName = objPatientProcudureDetail.ProcedureName;
                ProcedureCode = objPatientProcudureDetail.ProcedureCode;
                ProcedureDate = objPatientProcudureDetail.ProcedureDate;
                ProcedureTime = objPatientProcudureDetail.ProcedureTime;
                Remarks = objPatientProcudureDetail.Remarks;
                Consultant = objPatientProcudureDetail.Consultant;
                ReportId = objPatientProcudureDetail.ReportId;
                Billing = objPatientProcudureDetail.Billing;

                try
                {
                    ResultVal = DBL.RunSPReturnInteger("SP_SetPatientProcudureDetail",
                    new SqlParameter("@vchID", ID),
                   new SqlParameter("@vchCRNumber", CRNumber),
                     new SqlParameter("@vchProcedureName", ProcedureName),
                     new SqlParameter("@vchProcedureCode", ProcedureCode),
                     new SqlParameter("@dtProcedureDate", ProcedureDate),
                     new SqlParameter("@vchProcedureTime", ProcedureTime),
                     new SqlParameter("@vchRemarks", Remarks),
                     new SqlParameter("@vchConsultant", Consultant),
                     new SqlParameter("@vchReportId", ReportId),
                     new SqlParameter("@vchBilling", Billing));
                    if (ResultVal == 0) { bresult = true; } else { bresult = false; } return bresult;
                }
                catch (SqlException ex)
                {
                    string errorMessage = string.Format(
                        "An Error Occurred While Loading the PatientProcudureDetail Information to the DB. Message: {0}", ex.Message);
                    //throw new MappingException(errorMessage, ex);}
                    return false;
                }
                finally
                {
                    DBL.Dispose();
                }
            }

            else { return false; }
        }

        public void Dispose()
        {
            this.Dispose(true);
            System.GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
        }


    }
}